//
// Created by Shin on 2023/11/9.
//

#ifndef MAIN_C_SENSOR_H
#define MAIN_C_SENSOR_H

#include "main.h"
#include "ROS_car_cfg.h"

#if USE_WIT
    #include "BWT901/BTW901.h"
#elif USE_MPU6050
    #include "MPU6050/myMPU6050.h.h"
#endif

typedef struct imu_t{
    float pitch;
    float roll;
    float yaw;

    float gyro[3];
    float accel[3];

    float quat[4];

    int is_latest[4];
    int is_alive;
}imu_t;

extern imu_t ros_imu;

void sensor_init(void);
int imu_is_ready(void);
void imu_data_update(uint8_t *data_source);
uint8_t imu_data_sum_crc(uint8_t *data, int data_num);
uint8_t imu_get_data(float *pitch,float *roll,float *yaw, float gyro[3], float accel[3], float quat[4]);

#endif //MAIN_C_SENSOR_H
